1. Field of the Invention
The invention relates to a drawing processing apparatus and a drawing processing method for processing drawing data.
2. Description of the Related Art
Rendering engines for three-dimensional computer graphics are now gaining programmability and becoming more processor-like in order to cope with complex, sophisticated shading algorithms. In particular, pixel shaders, the cores of the rendering engines, are transforming themselves from hardware pieces which implement fixed graphics capabilities into processors which have built-in arithmetic units having instruction sets, like CPUs, and are capable of adding capabilities flexibly by programming.
In current programmable pixel shaders, polygon setting is performed on three-dimensional objects to be drawn before the pixel data obtained by rasterizing the polygons is processed to calculate final color values. To achieve more complex shading processing, a technique called multipass rendering is used. Multipass rendering is the technique of dividing the shading processing into a plurality of operation passes, and applying different arithmetic processes to identical drawing primitives a plurality of times. This technique allows finer drawing processing for higher drawing quality.
In multipass rendering, the drawing processing on one or more drawing primitives is divided into and performed in a plurality of passes. Some passes may fail to process all the drawing primitives at a time due to limited buffer capacities, however, in which case the passes are divided into intervals having a certain number of pixels each and the arithmetic processes on the passes are performed interval by interval. For example, given passes 1 to n, an arithmetic process is performed from the pass 1 in order. When the arithmetic process is completed up to the pass n, the arithmetic process of the next interval is then performed similarly from the pass 1 to the pass n. This can be repeated to achieve the multipass rendering on the pixel data of all the drawing primitives.
For the sake of higher programming flexibility, programs make heavy use of control structures such as conditional branches and loops. When such control structures as conditional branches are introduced into multipass rendering, it is required to exercise a program control across passes. Necessary conditional data on all the pixels to be processed must therefore be collected for analysis, with a large amount of processing cost. The program control across passes also increases overhead ascribable to pass switching, which costs the processing efficiency. Thus, in multipass rendering, it is actually the case that the control structures of the programs must be confined within individual passes.